﻿using System;
using DRHotel_v1.Classes;
using DRHotel_v1.Classes.DBManagers;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;

namespace DRHotel_v1.RoomAvaAndBooking
{
    public partial class AvaRoomsFrm : Form
    {
        public ArrayList avaRoomsDS;
        public string selectedRoomID;
        public AvaRoomsFrm()
        {
            InitializeComponent();
        }

        private void AvaRooms_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = avaRoomsDS;
            dataGridView1.Columns[0].HeaderText = "Room ID";
            dataGridView1.Columns[1].HeaderText = "Room Type";
            dataGridView1.Columns[2].HeaderText = "Bed Type";
            dataGridView1.Columns[3].HeaderText = "Capacity";
            dataGridView1.Columns[4].HeaderText = "Room Rates";
            dataGridView1.Columns[5].HeaderText = "Smoking";
            dataGridView1.Columns[6].HeaderText = "Room Status";
            dataGridView1.Columns[7].HeaderText = "Remark";
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewTextBoxCell cell = (DataGridViewTextBoxCell)
                dataGridView1.Rows[e.RowIndex].Cells[0];

            selectedRoomID = Convert.ToString(cell.Value);
            tbxSelectedRoomID.Text = selectedRoomID;
        }

        

        private void btnSelect_Click(object sender, EventArgs e)
        {
            if (tbxSelectedRoomID.TextLength == 0)
            {
                MessageBox.Show("Please select a record to continue!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CheckInFrm.roomID = RoomAvaAndBookingDBManager.GetRoomByID(selectedRoomID).roomID.ToString();
            this.Close();
        }

    }
}
